package com.zhiyou100.mapper;

import com.zhiyou100.entity.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author yang
 */
public interface StudentMapper {
    //1. 查询所有学生
    List<Student> listStudents();

    //@Select("selcet * from student where sname = #{sname}")
    //Student selectOneBySname(String sname);
    @Select("select * from student where sname=#{sname}")
    Student selectOneBySname(String sname);

    @Select("selcet * from student where sx=#{sx} and sy = #{sy} ")
    Student selectOneBySxSy(@Param("sx") Integer sx, @Param("sy") Integer sy);

    @Insert("insert into student(sname,sx,sy) values(#{sname},#{sx},#{sy}")
    void insertOne(String student);

    @Update("update student set spwd=#{spwd} where sname = #{sname}")
    void updateSpwd(Student student);

//2. 添加考试
//3. 展示历史考试名字
//4. 展示某次考试的成绩
//5. 展示某次考试成绩 排序
}